package com.javabase.y2021.m12.day1215;

/**
 * @descriptions:
 * @author: Tom
 * @date: 2021/12/15 下午 01:17
 * @version: 1.0
 */
public class Code04_FirstThread extends Thread{
    private int i;
    public static void main(String[] args) {
//        System.out.println(Thread.currentThread().getName());
        for (int i = 0; i < 100; i++) {
            // 調用Thread的cuurentThread()方法獲取當前綫程
            System.out.println(Thread.currentThread().getName() + " " + i);
            if(i == 20){
                new Code04_FirstThread().start();
                new Code04_FirstThread().start();
            }
        }
    }


    @Override
    public void run() {
        for(;i < 100; i++){
            System.out.println(getName() + " " + i);
        }
    }
}
